{extend name="public/common"} {block name="body"}
<title>基本设置</title>
</head>
<style>
    .suglist li{
        cursor: pointer;
    }
    .suglist li:hover{
        background: #f3f3f3;
    }
    .ul_tab {
        height: 40px;
        background-color: #e5e5e5;
        border-bottom: 1px solid #e4e7ed;
    }

    .ul_tab li {
        position: relative;
        float: left;
        width: 112px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        cursor: pointer;
    }

    .ul_tab span {
        position: absolute;
        right: 0;
        top: 10px;
        background: #ddd;
        width: 1px;
        height: 14px;
        overflow: hidden;
    }
    .products {
        width: 98%;
        height: 100%;
        padding: 20px;
        margin-top: -9px;
    }

    .products .main {
        float: left;
        display: none;
        width: 100%;
    }

    .products .main.selected {
        display: block;
    }
    .ul_tab li.active {
        border-bottom: 1px solid #fff;
        background-color: #636363;
        border-right: 1px solid #ddd;
        border-left: 1px solid #ddd;
        color: white !important;
    }
    .active a {
        color: white;
    }
    .btn-success {
        color: #fff;
        background-color: #636363;
        border-color: #636363;
    }
    .btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active {
        color: #636363;
        background-color: #e5e5e5;
        border-color: #e5e5e5;
    }
    .table-bg thead th {
        background-color: #ffffff;
    }
    table tbody tr:hover{
        background-color: #f5f7fa !important;
    }
    .text{
        height: 44px;
    }
    .text th{
        color: #909399;
        font-size: 14px;
    }
    .text-c td{
        font-size: 14px;
    }
    .tab-item a{
        display: inline-block;
        width: 100%;
        height: 100%;
    }
    a:hover{

        text-decoration: none;
    }
    .tab-item a{
        color: #333;
    }

    .table-hover tbody tr:hover td,.table-hover tbody tr:hover th{background-color:#e5e5e5}
    .text th {
        color: #909399;
        font-size: 14px;

    }
    .navbar {
        background: #3f3f3f;
    }
    /*.text-c td {
        color: #909399;
    }
    .text-c td a {
        color: #909399;
    }*/

    .dataTables_wrapper .dataTables_paginate .paginate_button:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
        background: #e5e5e5;
        color: #636363;
    }
    
button:hover{
 	color: #fff;
	border-color: #66b1ff;
	background-color: #66b1ff;
 }
 span:hover{
 	color: #333;
 }
 button {
    color: #fff;
    background-color: #409eff;
    border-color: #409eff;
    height: 35px;
    width: 80px;
    border-radius: 5px;
    font-size: 16px !important;
    line-height: 22px !important;
}
</style>
<body>
  <nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
   
    彩票管理
    <span class="c-gray en">&gt;</span>
    赔率设置
     <span class="c-gray en">&gt;</span>
     {if(0==$method)}赔率模板{/if}
     {if(1==$method)}彩种赔率{/if}
    <a class="btn btn-success radius r"
      style="line-height: 1.6em; margin-top: 3px"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="Hui-iconfont">&#xe68f;</i>
    </a>
  </nav>
  <div style="padding:20px;height:30px;">
      <div style="width: 100%;height: 50px;">
          <ul class="ul_tab">
              <li class="tab-item {if(0==$method)} active{/if}"><a {if(0==$method)} style="color: white;"{/if}  href="{:url('lottery/cz_plsz')}?method=0">赔率模板</a></li>
              <li class="tab-item {if(1==$method)} active{/if}"><a {if(1==$method)} style="color: white;"{/if}  href="{:url('lottery/cz_plsz')}?method=1">彩种赔率</a></li>
          </ul>
      </div>
  	<div class="new_box">
<div class="text-c" style="padding :20px 0;">
    <div style="width:217px;" class="formControls col-xs-8 col-sm-9">
    	<span class="select-box">
			<select class="select" name="id" id="code">
			{volist name="caizhong" id="vo"}
				<option value="{$vo.id}" {if condition="input('get.id') == $vo.id"}selected{/if}>{$vo.class_name_lottery}</option>
			{/volist}
			</select>
		</span>
    </div>
    {if(1==$method)}
    <div style="display:inline-block;text-align: left;color: red;">
        <p>如果彩种赔率有设置，APP就以彩种设置的赔率为准，如果没有设置，就取模板里的设置。</p>
        <p>彩种赔率设置的时候可以点击同步数据，就把模板设置的复制过来了，然后自行修改赔率即可。</p>
    </div>
    <div style="display: block;float: right;margin-right: 150px;">
        <button style="font-size: 20px;padding: 5px;line-height: 10px;margin-bottom: 5px;" onclick="asyncInfo()">同步数据</button>
    </div>
    {/if}
  </div>
<form class="am-form am-g" method="post">
     <div class="page-container" style="padding-top:0;">
      <div id="tab-system" class="HuiTab">
        <div class="tabCon">
          <div class="mt-20">
            <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
              <thead>
                <tr class="text-c">
                  <th>ID</th>
                  <th>赔率名称</th>
                  <th>赔率</th>
                 <!--  <th>最低赔率</th> -->
                  
                </tr>
                
              </thead>
                <tbody>
              {volist name="list" id="PL"}
                <tr class="text-c">
                  <td>{$PL.id}</td>
                  <td>{$PL.peilv_name}</td>
                  <td>
                    <input name='zgpl_{$PL.id}' value='{$PL.zgpl}' style='font-size:12px; text-align:center; width:100px' onchange="updatePlInfo(this.value,this.name)" onkeypress="if(event.keyCode == 13){ blur()}"/>
                  </td>
                <!--   <td>
                    <input name='zdpl_{$PL.id}' value='{$PL.zdpl}' style='font-size:12px; text-align:center; width:100px' onchange="updatePlInfo(this.value,this.name)" onkeypress="if(event.keyCode == 13){ blur()}"/>
                  </td> -->
                </tr>
              {/volist}
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    </div>
    </div>
    <div class="am-margin" style="margin-top:60px;">
   
  </div>
</form>
{/block}{block name="js"}
<script type="text/javascript">
$("#code").on('change',function(){
	var id = $(this).find('option:selected').val();

	window.location.href="/admin/lottery/cz_plsz?id="+id+'&method='+{$method};
})
	$(function() {
		$('.skin-minimal input').iCheck({
			checkboxClass : 'icheckbox-blue',
			radioClass : 'iradio-blue',
			increaseArea : '20%'
		});
		$("#tab-system").Huitab({
			index : 0
		});
	});
</script>
<script type="text/javascript">
function updatePlInfo(value,name) {
	$.ajax({
        type : "post",
        url : "{:url('lottery/updatePlInfo')}",
        data : {"name":name,"value":value},
        success: function (data) {
        	if(data==1) {
        		alert("更新成功");
        	} else {
        		alert("更新失败请重试！");
        	}
        }
    });
}
function asyncInfo(){
    if( confirm("同步赔率数据后，当前设置的数据将与赔率模板一致，确定同步吗？") ){
        var id = $('#code option:selected').val();
        $.ajax({
            type : "post",
            url : "{:url('lottery/asyncInfo')}",
            data : {"id":id},
            success: function (data) {
                if(data==1) {
                    alert("同步成功");
                    location.reload();
                } else {
                    alert("同步失败！");
                }
            }
        });
    }
}
</script>

{/block}